package itman.controller;

import itman.po.Business;
import itman.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/BusinessController")
public class BusinessController {
    @Autowired
    private BusinessService businessService;


    /**
     * 根据点餐分类编号查询所属商家信息
     * @param business
     * @return
     */
    @RequestMapping("/listBusinessByOrderTypeId")
    public List<Business> listBusinessByOrderTypeId(Business business)throws Exception{
        return businessService.listBusinessByOrderTypeId(business.getOrderTypeId());
    }

    /**
     * 根据商家编号查询商家信息
     * @param business
     * @return
     */
    @RequestMapping("/getBusinessById")
    public Business getBusinessById(Business business ){
        return businessService.getBusinessById(business.getBusinessId());
    }
}
